using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
using StructureMap.Configuration.DSL.Expressions;

namespace StructureMap.WcfIntegration
{
    public class StructureMapInstanceProvider : IInstanceProvider
    {
        private readonly Type _serviceType;
        private readonly IContainer container;


        public StructureMapInstanceProvider(Type serviceType, IContainer container)
        {
            _serviceType = serviceType;
            this.container = container;
        }

        public object GetInstance(InstanceContext instanceContext)
        {

            return GetInstance(instanceContext, null);
        }

        public object GetInstance(InstanceContext instanceContext, Message message)
        {
            return container.GetInstance(_serviceType);
        }

        public void ReleaseInstance(InstanceContext instanceContext, object instance)
        {
        }
    }

}